libs := $(shell ls -d ../Libraries/*/)
apps := $(shell ls -d ../Applications/*/)
SYSROOT = ..

include ../System/makefile.platform

DOCROOT ?= $(sysroot)
export docroot	:= $(DOCROOT)
export docdir	:= .
export docsrc	:= $(addprefix ./,$(libs) $(addsuffix /src,$(libs)) $(addsuffix /include,$(libs)) $(addsuffix /doc,$(libs)))
export docinc	:= $(addprefix ./,$(libs)) $(addsuffix /include,$(libs))
export docver	:= $(EOSVER_MINOR).$(EOSVER_MAJOR)
export docrtf	:= NO
export docverbose := NO

# You might have to make sure that cygwin find.exe is in the path before the windows file
target: all
all: docrtf = YES
all: doc

rtf: docrtf = YES
rtf: doc
	@echo "Documentation generated at rtf/refman.rtf"

html: doc
	@echo "Documentation generated at html/index.html"

doc:
	echo $(docsrc)
	@"doxygen" "../System/doxygen.conf"
	@echo ""
	@echo "Done, errorlog follows:"
	@cat "doxygen.log"
	@echo ""
	@$(RM) -r *.tmp
	@cp $(sysroot)/System/scatterweb.css $(docdir)/html

.PHONY: clean rtf doc
clean:
	@echo "  > Documentation"
	@$(RM) -r "$(docdir)/html"
	@$(RM) -r "$(docdir)/rtf"
	@$(RM) -r "$(docdir)/latex"
	@$(RM) -r "$(docdir)/Properties" "$(docdir)/obj" "BuildLog.html" *.log *.tmp
